import request from "@/utils/request";

// 查询用户信息;列表
export function listUser(query) {
    return request({
        url: "/admin/user/list",
        method: "get",
        params: query
    });
}

export function getUserByToken(token) {
    return request({
        url: "/admin/user/token",
        method: "POST",
        params: {token: token}
    });
}

// 查询用户信息;详细
export function getUser(userId) {
    return request({
        url: "/admin/user/" + userId,
        method: "get"
    });
}

// 新增用户信息;
export function addUser(data) {
    return request({
        url: "/admin/user",
        method: "post",
        data: data
    });
}

// 修改用户信息;
export function updateUser(data) {
    return request({
        url: "/admin/user",
        method: "put",
        data: data
    });
}

// 删除用户信息;
export function delUser(userId) {
    return request({
        url: "/admin/user/" + userId,
        method: "delete"
    });
}

//修改密码
export function updatePassword(user) {
    return request({
        url: "/admin/user/password",
        method: "put",
        data: user
    });
}
